<div id="addnew_tour"></div>
<div id="tours_table">
  <%= link_to 'Add New', new_tour_path, class: "btn btn-primary", remote: true %> <br/> <br/>

  <table class="table">
    <thead>
      <tr>
        <th><%= "tour_name" %></th>
        <th><%= "tour_type" %></th>
        <th><%= "area_id" %></th>
        <th><%= "price" %></th>
        <th><%= "Promo" %></th>
        <th style="text-align:center;">Status</th>
        <th style="text-align:center;" colspan="2">Option</th>
        <th style="text-align:center;" colspan="2">Action</th>
      </tr>
    </thead>

    <tbody id="tours">
      <% @tours.each do |tour| %>
        <tr>
          <td><%= tour.tour_name_eng %><br/><%= image_tag tour.primary_picture.url(:thumb) %></td>
          <td class="text-center"><%= tour.tour_type.tour_type_name unless tour.tour_type.blank? %></td>
          <td class="text-center"><%= tour.area.area unless tour.area.blank? %></td>
          <td class="text-center"><%= tour.usd_price %></td>
          <td class="text-center"><%= tour.usd_promotion_price %></td>
          <td class="text-center">
            <span class="<%= (tour.is_published == false) ? raw('label label-important') : raw('label label-success') %>"><%= (tour.is_published == true) ? raw('Published') : raw('Not Published') %></span><br/> <br/>
            <span class="<%= (tour.is_on_promoted == false) ? raw('label label-important') : raw('label label-success') %>"><%= (tour.is_on_promoted == true) ? raw('Promoted') : raw('Not Promoted') %></span><br/> <br/>
            <span class="<%= (tour.is_recomended == false) ? raw('label label-important') : raw('label label-success') %>"><%= (tour.is_recomended == true) ? raw('Recomended') : raw('Not Recomended') %></span><br/> <br/>
          </td>
          <td class="text-center"><%= link_to "Tour Days", tour_days_path({ tid: tour.id }), remote: true %></td>
          <td class="text-center"><%= link_to "Images", tour_images_path({ tid: tour.id }), remote: true %></td> 
          <td class="text-center">
            <%= link_to 'Edit', edit_tour_path(tour), remote: true %> | 
            <%= link_to 'Delete', tour, method: :delete, remote: true, data: { confirm: 'Are you sure?' } %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>


  <div class="collection_paginator">
    <%#= will_paginate tours %>
  </div>

</div>